package com.example.manpower.Controller;

import com.example.manpower.Entity.Admin;
import com.example.manpower.Server.AdminServer;
import com.example.manpower.Util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/Admin")
public class AdminController {

    @Autowired
    AdminServer adminServer;

    //管理员登录接口
    @PostMapping("/login")
    public Result login(@RequestBody Admin admin) {
        System.out.println(admin.getAdminAccount());
        System.out.println(admin.getAdminPassword());
        return adminServer.login(admin);
    }
    //新增接口
    @PostMapping("/add")
    public Result add(@RequestBody Admin admin) {
        return adminServer.add(admin);
    }

    //分页查询
    @GetMapping("/selectList")
    public Result selectList(Admin admin) {
        return adminServer.selectList(admin);
    }

    @PostMapping("/delete")
    //删除
    public Result delete(@RequestBody Admin admin) {
        return adminServer.delete(admin);
    }

    //修改
    @PostMapping("/update")
    public Result update(@RequestBody Admin admin) {
        return adminServer.update(admin);
    }


}
